home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 676-700 / 685 / publicmanager / publictools / setdefpubscreen.s < prev    next >
Text File  |  1995-03-18  |  2KB  |  111 lines

  1. ;    SetPubScreen
  2. ;
  3. ;    written by Michael Watzl in 1992
  4. ;
  5. ;    this is Public Domain
  6. ;
  7.  
  8. ; lazy includes
  9.  
  10. OpenLib        = -552
  11. Output        = -60
  12. CloseLib        = -414
  13. SetDefaultPubScreen    = -$21C
  14. PutStr        = -948
  15. LockPubScreen    = -$1FE
  16. UnlockPubScreen    = -$204
  17.  
  18.  
  19. Title        = 22
  20.  
  21. TAB    = 09
  22. CR    = 10
  23.  
  24. ******************************************
  25. **                **
  26. **          MAIN        **
  27. **                **
  28. ******************************************
  29.  
  30. _main    pea    (a0)        ; save the argument pointer
  31.     lea    DosName,a1    ; open the libs
  32.     move.l    4.w,a6
  33.     moveq    #36,d0        ; version
  34.     jsr    OpenLib(a6)    ; open dos.library
  35.     tst.l    d0
  36.     beq    _quit
  37.     move.l    d0,_DosBase
  38.     lea    IntName,a1
  39.     move.l    4.w,a6
  40.     moveq    #36,d0        ; I think V36 should work
  41.     jsr    OpenLib(a6)
  42.     move.l    d0,_IntBase
  43.  
  44.     move.l    (sp)+,a0        ; fetch argument pointer
  45.     cmp.b    #CR,(a0)        ; are any args out there!
  46.     beq    _usage
  47.  
  48.     pea    (a0)
  49. Loop    cmp.b    #CR,(a0)+
  50.     bne.s    Loop
  51.     move.b    #0,-(a0)
  52.     movea.l    (sp)+,a0
  53.  
  54.     move.l    _IntBase,a6
  55.     jsr    SetDefaultPubScreen(a6)    Name is alredy in a0
  56.  
  57. _usage    move.l    _IntBase,a6
  58.     suba.l    a0,a0
  59.     jsr    LockPubScreen(a6)
  60.     move.l    d0,a3
  61.     movea.l    Title(a3),a4    ; save the title
  62.  
  63.     move.l    _DosBase,a6
  64.     move.l    #usage,d1
  65.     jsr    PutStr(a6)
  66.     move.l    #author,d1
  67.     jsr    PutStr(a6)
  68.     move.l    #info,d1
  69.     jsr    PutStr(a6)
  70.     move.l    a4,d1
  71.     jsr    PutStr(a6)
  72.     move.l    #return,d1
  73.     jsr    PutStr(a6)
  74.  
  75.     move.l    _IntBase,a6
  76.     suba.l    a0,a0
  77.     movea.l    a3,a1
  78.     jsr    UnlockPubScreen(a6)
  79.  
  80. ******************************************
  81. **                **
  82. **                 QUIT        **
  83. **                **
  84. ******************************************
  85.  
  86. _quit    move.l    4.w,a6
  87.     move.l    _DosBase,d0    if(DOSBase)
  88.     tst.l    d0
  89.     beq.s    next1
  90.     movea.l    d0,a1
  91.     jsr    CloseLib(a6)        Close
  92. next1    move.l    _IntBase,d0    if(IntuitionBase)
  93.     tst.l    d0
  94.     beq.s    next2
  95.     movea.l    d0,a1
  96.     jsr    CloseLib(a6)        Close
  97.     moveq    #0,d0
  98. next2    rts            "My only friend, the end" (Doors...)
  99.  
  100.  
  101. DosName    dc.b    "dos.library"        ; this order saves 2 bytes (Wow!)
  102. _DosBase    dc.l    0
  103. IntName   dc.b    "intuition.library"
  104. _IntBase    dc.l    0
  105.  
  106. usage    dc.b    "Usage:",TAB,"SetDefaultPubScreen <Name>",CR,TAB,TAB,"name",TAB,"the title of the new default public screen",CR,0
  107. author    dc.b    TAB,TAB,27,"[32mWritten by Michael Watzl in 1992 (PD!)",27,"[31m",CR,0
  108. info    dc.b    "Current default: »",27,"[33m",0
  109. return    dc.b    27,"[31m«",CR,0
  110.  
  111.